home *** CD-ROM | disk | FTP | other *** search
/ SGI Freeware 1999 August / SGI Freeware 1999 August.iso / dist / fw_qt.idb / usr / freeware / include / Qt / qlineedit.h.z / qlineedit.h
Encoding:
C/C++ Source or Header  |  1998-10-28  |  3.6 KB  |  153 lines

  1. /**********************************************************************
  2. ** $Id: qlineedit.h,v 2.29 1998/07/03 00:09:49 hanord Exp $
  3. **
  4. ** Definition of QLineEdit widget class
  5. **
  6. ** Created : 941011
  7. **
  8. ** Copyright (C) 1992-1998 Troll Tech AS.  All rights reserved.
  9. **
  10. ** This file is part of Qt Free Edition, version 1.40.
  11. **
  12. ** See the file LICENSE included in the distribution for the usage
  13. ** and distribution terms, or http://www.troll.no/free-license.html.
  14. **
  15. ** IMPORTANT NOTE: You may NOT copy this file or any part of it into
  16. ** your own programs or libraries.
  17. **
  18. ** Please see http://www.troll.no/pricing.html for information about 
  19. ** Qt Professional Edition, which is this same library but with a
  20. ** license which allows creation of commercial/proprietary software.
  21. **
  22. *****************************************************************************/
  23.  
  24. #ifndef QLINEEDIT_H
  25. #define QLINEEDIT_H
  26.  
  27. struct QLineEditPrivate;
  28.  
  29. class QComboBox;
  30. class QValidator;
  31.  
  32.  
  33. #ifndef QT_H
  34. #include "qwidget.h"
  35. #include "qstring.h"
  36. #endif // QT_H
  37.  
  38.  
  39. class QLineEdit : public QWidget
  40. {
  41.     Q_OBJECT
  42. public:
  43.     QLineEdit( QWidget *parent=0, const char *name=0 );
  44.    ~QLineEdit();
  45.  
  46.     const char *text() const;
  47.     int        maxLength()    const;
  48.     void    setMaxLength( int );
  49.  
  50.     void    setFrame( bool );
  51.     bool    frame() const;
  52.  
  53.     enum    EchoMode { Normal, NoEcho, Password };
  54.     void    setEchoMode( EchoMode );
  55.     EchoMode     echoMode() const;
  56.  
  57.     void    setValidator( QValidator * );
  58.     QValidator * validator() const;
  59.  
  60.     QSize    sizeHint() const;
  61.  
  62.     void    setEnabled( bool );
  63.     void    setFont( const QFont & );
  64.  
  65.     void    setSelection( int, int );
  66.     void    setCursorPosition( int );
  67.     int        cursorPosition() const;
  68.  
  69.     bool    validateAndSet( const char *, int, int, int );
  70.  
  71.  public slots:
  72.     void    setText( const char * );
  73.     void    selectAll();
  74.     void    deselect();
  75.  
  76.     void    clearValidator();
  77.  
  78.     void    insert( const char * );
  79.  
  80.     void    clear();
  81.  
  82. signals:
  83.     void    textChanged( const char * );
  84.     void    returnPressed();
  85.  
  86. protected:
  87.     void    mousePressEvent( QMouseEvent * );
  88.     void    mouseMoveEvent( QMouseEvent * );
  89.     void    mouseReleaseEvent( QMouseEvent * );
  90.     void    mouseDoubleClickEvent( QMouseEvent * );
  91.     void    keyPressEvent( QKeyEvent * );
  92.     void    focusInEvent( QFocusEvent * );
  93.     void    focusOutEvent( QFocusEvent * );
  94.     void    paintEvent( QPaintEvent * );
  95.     void    timerEvent( QTimerEvent * );
  96.     void    resizeEvent( QResizeEvent * );
  97.     void    leaveEvent( QEvent * );
  98.  
  99.     bool    event( QEvent * );
  100.  
  101.     bool    hasMarkedText() const;
  102.     QString    markedText() const;
  103.  
  104.  
  105.     void    repaintArea( int, int );
  106.  
  107. private slots:
  108.     void    clipboardChanged();
  109.     void    blinkSlot();
  110.     void    dragScrollSlot();
  111.  
  112. private:
  113.     // obsolete
  114.     void    paint( const QRect& clip, bool frame = FALSE );
  115.     void    pixmapPaint( const QRect& clip );
  116.     // kept
  117.     void    paintText( QPainter *, const QSize &, bool frame = FALSE );
  118.     // to be replaced by publics
  119.     void    cursorLeft( bool mark, int steps = 1 );
  120.     void    cursorRight( bool mark, int steps = 1 );
  121.     void    backspace();
  122.     void    del();
  123.     void    home( bool mark );
  124.     void    end( bool mark );
  125.     // kept
  126.     void    newMark( int pos, bool copy=TRUE );
  127.     void    markWord( int pos );
  128.     void    copyText();
  129.     int        lastCharVisible() const;
  130.     int        minMark() const;
  131.     int        maxMark() const;
  132.  
  133.     QString    tbuf;
  134.     QLineEditPrivate * d;
  135.     int        cursorPos;
  136.     int        offset;
  137.     int        maxLen;
  138.     int        markAnchor;
  139.     int        markDrag;
  140.     bool    cursorOn;
  141.     bool    dragScrolling;
  142.     bool    scrollingLeft;
  143.  
  144. private:    // Disabled copy constructor and operator=
  145.     QLineEdit( const QLineEdit & );
  146.     QLineEdit &operator=( const QLineEdit & );
  147.  
  148.     friend class QComboBox;
  149. };
  150.  
  151.  
  152. #endif // QLINEEDIT_H
  153.